﻿using System;
using System.IO;
using SEXY;
using UnityEngine;

namespace Character
{
	// Token: 0x0200019A RID: 410
	public class ColorParameter_PBR2 : ColorParameter_Base
	{
		// Token: 0x06000AC7 RID: 2759 RVA: 0x0003E278 File Offset: 0x0003C478
		public ColorParameter_PBR2()
		{
		}

		// Token: 0x06000AC8 RID: 2760 RVA: 0x0003E2AC File Offset: 0x0003C4AC
		public ColorParameter_PBR2(ColorParameter_PBR2 src)
		{
			this.mainColor1 = src.mainColor1;
			this.specColor1 = src.specColor1;
			this.specular1 = src.specular1;
			this.smooth1 = src.smooth1;
			this.mainColor2 = src.mainColor2;
			this.specColor2 = src.specColor2;
			this.specular2 = src.specular2;
			this.smooth2 = src.smooth2;
		}

		// Token: 0x06000AC9 RID: 2761 RVA: 0x0003E34C File Offset: 0x0003C54C
		public ColorParameter_PBR2(MaterialCustoms custom)
		{
			this.mainColor1 = custom.GetColor("MainColor");
			this.specColor1 = custom.GetColor("MainSpecColor");
			this.specular1 = custom.GetFloat("MainMetallic");
			this.smooth1 = custom.GetFloat("MainSmoothness");
			this.mainColor2 = custom.GetColor("SubColor");
			this.specColor2 = custom.GetColor("SubSpecColor");
			this.specular2 = custom.GetFloat("SubMetallic");
			this.smooth2 = custom.GetFloat("SubSmoothness");
		}

		// Token: 0x06000ACA RID: 2762 RVA: 0x0003E414 File Offset: 0x0003C614
		public override COLOR_TYPE GetColorType()
		{
			return COLOR_TYPE.PBR2;
		}

		// Token: 0x06000ACB RID: 2763 RVA: 0x0003E418 File Offset: 0x0003C618
		public override void Save(BinaryWriter writer)
		{
			base.Save_ColorType(writer);
			base.WriteColor(writer, this.mainColor1);
			base.WriteColor(writer, this.specColor1);
			writer.Write(this.specular1);
			writer.Write(this.smooth1);
			base.WriteColor(writer, this.mainColor2);
			base.WriteColor(writer, this.specColor2);
			writer.Write(this.specular2);
			writer.Write(this.smooth2);
		}

		// Token: 0x06000ACC RID: 2764 RVA: 0x0003E490 File Offset: 0x0003C690
		public override bool Load(BinaryReader reader, CUSTOM_DATA_VERSION version)
		{
			if (version < CUSTOM_DATA_VERSION.DEBUG_04)
			{
				base.ReadColor(reader, ref this.mainColor1);
				return true;
			}
			COLOR_TYPE color_TYPE = ColorParameter_Base.Load_ColorType(reader, version);
			if (color_TYPE == COLOR_TYPE.NONE)
			{
				return false;
			}
			if (color_TYPE != this.GetColorType())
			{
				GlobalData.Debug_LogError("颜色类型不同");
			}
			base.ReadColor(reader, ref this.mainColor1);
			base.ReadColor(reader, ref this.specColor1);
			this.specular1 = reader.ReadSingle();
			this.smooth1 = reader.ReadSingle();
			base.ReadColor(reader, ref this.mainColor2);
			base.ReadColor(reader, ref this.specColor2);
			if (version < CUSTOM_DATA_VERSION.DEBUG_05)
			{
				this.specular2 = 0f;
			}
			else
			{
				this.specular2 = reader.ReadSingle();
			}
			this.smooth2 = reader.ReadSingle();
			return true;
		}

		// Token: 0x06000ACD RID: 2765 RVA: 0x0003E558 File Offset: 0x0003C758
		public void FromSexyData(HSColorSet colorSet1, HSColorSet colorSet2)
		{
			this.mainColor1 = colorSet1.rgbaDiffuse;
			this.specColor1 = colorSet1.rgbSpecular;
			this.specular1 = colorSet1.specularIntensity;
			this.smooth1 = colorSet1.specularSharpness;
			this.mainColor2 = colorSet2.rgbaDiffuse;
			this.specColor2 = colorSet2.rgbSpecular;
			this.specular2 = colorSet2.alpha;
			this.smooth2 = colorSet2.specularSharpness;
		}

		// Token: 0x06000ACE RID: 2766 RVA: 0x0003E5C8 File Offset: 0x0003C7C8
		public override void SetToMaterial(Material material)
		{
			GlobalData.Debug_LogError("不要用");
			material.color = this.mainColor1;
			material.SetColor(CustomDataManager._SpecColor, this.specColor1);
			material.SetFloat(CustomDataManager._Metallic, this.specular1);
			material.SetFloat(CustomDataManager._Smoothness, this.smooth1);
			Color color = this.specColor2;
			color.a = this.smooth2;
			material.SetColor(CustomDataManager._Color_3, this.mainColor2);
			material.SetColor(CustomDataManager._SpecColor_3, color);
		}

		// Token: 0x06000ACF RID: 2767 RVA: 0x0003E650 File Offset: 0x0003C850
		public void SetMaterialCustoms(MaterialCustoms custom)
		{
			custom.SetColor("MainColor", this.mainColor1);
			custom.SetColor("MainSpecColor", this.specColor1);
			custom.SetFloat("MainMetallic", this.specular1);
			custom.SetFloat("MainSmoothness", this.smooth1);
			custom.SetColor("SubColor", this.mainColor2);
			custom.SetColor("SubSpecColor", this.specColor2);
			custom.SetFloat("SubMetallic", this.specular2);
			custom.SetFloat("SubSmoothness", this.smooth2);
		}

		// Token: 0x06000AD0 RID: 2768 RVA: 0x0003E6E8 File Offset: 0x0003C8E8
		public void Copy(ColorParameter_PBR2 source)
		{
			this.mainColor1 = source.mainColor1;
			this.specColor1 = source.specColor1;
			this.specular1 = source.specular1;
			this.smooth1 = source.smooth1;
			this.mainColor2 = source.mainColor2;
			this.specColor2 = source.specColor2;
			this.specular2 = source.specular2;
			this.smooth2 = source.smooth2;
		}

		// Token: 0x04000AC2 RID: 2754
		public Color mainColor1 = Color.white;

		// Token: 0x04000AC3 RID: 2755
		public Color specColor1 = Color.white;

		// Token: 0x04000AC4 RID: 2756
		public float specular1;

		// Token: 0x04000AC5 RID: 2757
		public float smooth1;

		// Token: 0x04000AC6 RID: 2758
		public Color mainColor2 = Color.white;

		// Token: 0x04000AC7 RID: 2759
		public Color specColor2 = Color.white;

		// Token: 0x04000AC8 RID: 2760
		public float specular2;

		// Token: 0x04000AC9 RID: 2761
		public float smooth2;
	}
}
